home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3c / getgrent.z / getgrent
Encoding:
Text File  |  2002-10-03  |  10.1 KB  |  199 lines

  1.  
  2.  
  3.  
  4. GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))                                                      GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      getgrent, getgrent_r, getgrgid, getgrgid_r, getgrnam, getgrnam_r,
  10.      setgrent, endgrent, fgetgrent, fgetgrent_r, getgrmember - get group file
  11.      entry
  12.  
  13. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.      ####iiiinnnncccclllluuuuddddeeee <<<<ggggrrrrpppp....hhhh>>>>
  15.  
  16.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggeeeettttggggrrrreeeennnntttt((((vvvvooooiiiidddd))));;;;
  17.  
  18.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggeeeettttggggrrrreeeennnntttt____rrrr((((ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggrrrreeeennnntttt,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee))));;;;
  19.  
  20.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggeeeettttggggrrrrggggiiiidddd((((ggggiiiidddd____tttt ggggiiiidddd))));;;;
  21.  
  22.      iiiinnnntttt ggggeeeettttggggrrrrggggiiiidddd____rrrr((((ggggiiiidddd____tttt ggggiiiidddd,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggrrrreeeennnntttt,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ********ggggrrrrpppp))));;;;
  23.  
  24.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggeeeettttggggrrrrnnnnaaaammmm((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****nnnnaaaammmmeeee))));;;;
  25.  
  26.      iiiinnnntttt ggggeeeettttggggrrrrnnnnaaaammmm____rrrr((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****nnnnaaaammmmeeee,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggrrrreeeennnntttt,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ********ggggrrrrpppp))));;;;
  27.  
  28.      vvvvooooiiiidddd sssseeeettttggggrrrreeeennnntttt((((vvvvooooiiiidddd))));;;;
  29.  
  30.      vvvvooooiiiidddd eeeennnnddddggggrrrreeeennnntttt((((vvvvooooiiiidddd))));;;;
  31.  
  32.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ffffggggeeeettttggggrrrreeeennnntttt((((FFFFIIIILLLLEEEE ****ffff))));;;;
  33.  
  34.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ffffggggeeeettttggggrrrreeeennnntttt____rrrr((((FFFFIIIILLLLEEEE ****ffff,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggrrrreeeennnntttt,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee))));;;;
  35.  
  36.      iiiinnnntttt ggggeeeettttggggrrrrmmmmeeeemmmmbbbbeeeerrrr((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****nnnnaaaammmmeeee,,,, ggggiiiidddd____tttt ggggiiiidddd____aaaarrrrrrrraaaayyyy[[[[]]]],,,, iiiinnnntttt mmmmaaaaxxxxggggiiiiddddssss,,,, iiiinnnntttt vvvvggggiiiiddddssss))));;;;
  37.  
  38. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  39.      _g_e_t_g_r_e_n_t, _g_e_t_g_r_g_i_d and _g_e_t_g_r_n_a_m and their reentrant counterparts each
  40.      return pointers to an object with the following structure containing the
  41.      broken-out fields of a line in the /_e_t_c/_g_r_o_u_p file or some other back-end
  42.      group database.  Each line contains a ``group'' structure, defined in the
  43.      <_g_r_p._h> header file.
  44.  
  45.           struct group {
  46.                  char    *gr_name;   /* the name of the group */
  47.                  char    *gr_passwd; /* the encrypted group password */
  48.                  gid_t   gr_gid;     /* the numerical group ID */
  49.                  char    **gr_mem;   /* vector of pointers to member names */
  50.           };
  51.  
  52.      _g_e_t_g_r_e_n_t when first called returns a pointer to the first group structure
  53.      in the file; thereafter, it returns a pointer to the next group structure
  54.      in the file; so, successive calls may be used to search the entire file.
  55.      _g_e_t_g_r_g_i_d searches from the beginning of the file until a numerical group
  56.      id matching _g_i_d is found and returns a pointer to the particular
  57.      structure in which it was found.  _g_e_t_g_r_n_a_m searches from the beginning of
  58.      the file until a group name matching _n_a_m_e is found and returns a pointer
  59.      to the particular structure in which it was found.  If an end-of-file or
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))                                                      GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))
  71.  
  72.  
  73.  
  74.      an error is encountered on reading, these functions return a NULL
  75.      pointer.
  76.  
  77.      The _g_e_t_g_r_n_a_m__r and _g_e_t_g_r_g_i_d__r calls are reentrant versions of the
  78.      _g_e_t_g_r_n_a_m and _g_e_t_g_r_g_i_d calls.   The extra arguments grent and buffer are
  79.      used for internal storage, bufsize is size of buffer, and grp is the
  80.      struct group used to return the requested information.  A good size of
  81.      buffer is BUFSIZ bytes.
  82.  
  83.      A call to _s_e_t_g_r_e_n_t has the effect of rewinding the group file to allow
  84.      repeated searches.  _e_n_d_g_r_e_n_t may be called to close the group file when
  85.      processing is complete.
  86.  
  87.      _f_g_e_t_g_r_e_n_t returns a pointer to the next group structure in the stream _f,
  88.      which matches the format of ////eeeettttcccc////ggggrrrroooouuuupppp.
  89.  
  90. NNNNOOOOTTTTEEEESSSS
  91.      In IRIX 4.0, there were two versions of the getpwent primitives:  the
  92.      standard version in libc and the NIS version in libsun.  This release
  93.      contains only routines to parse files, an external file supply mechanism
  94.      nsd(1) supplies data from NIS and other protocols as files.  To force
  95.      these routines to not use nsd supplied data set the external
  96.      __g_e_t_p_w_e_n_t__n_o__y_p variable to 1. This is useful for programs that must not
  97.      generate any network traffic, and for programs that update the /_e_t_c/_g_r_o_u_p
  98.      file.
  99.  
  100.  
  101.      _g_e_t_g_r_m_e_m_b_e_r is used to get the ids of the groups of which the given user
  102.      is a member.  _n_a_m_e is the name of the user.  The group ids are returned
  103.      in the array _g_i_d__a_r_r_a_y which contains _m_a_x_g_i_d_s elements.  The first _v_g_i_d
  104.      elements of _g_i_d__a_r_r_a_y are not used by _g_e_t_g_r_m_e_m_b_e_r and can be used by the
  105.      caller to initialize default group ids.  _g_e_t_g_r_m_e_m_b_e_r is usually called by
  106.      _i_n_i_t_g_r_o_u_p_s. _g_e_t_g_r_m_e_m_b_e_r returns the number of valid gids in the gid array
  107.      or -1 if an error is encountered.
  108.  
  109.      The Mips ABI specifies nothing but local files so applications which wish
  110.      to use anything else must compile with libc prior to libnsl in the
  111.      library list.
  112.  
  113.      When nsd is running changes in the group file may not be seen by
  114.      getgrent() until the nsd enumeration cache file has timed out.
  115.  
  116. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  117.      All routines that return a struct group * will return a NULL pointer in
  118.      the case of EOF or failure. The reentrant functions return the errno(3C)
  119.      for the call, and thus 0 implies success.  The getgrmember call returns
  120.      the number of gids found, and -1 on failure.
  121.  
  122. FFFFIIIILLLLEEEESSSS
  123.      /etc/group /var/ns/cache/group.byname.m /var/ns/cache/group.bygid.m
  124.      /var/ns/cache/group.bymember.m
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))                                                      GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))
  137.  
  138.  
  139.  
  140. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  141.      nsd(1M), getgroups(2), errno(3C), getlogin(3C), getpwent(3C), group(4).
  142.  
  143. WWWWAAAARRRRNNNNIIIINNNNGGGG
  144.      The above routines use the _s_t_d_i_o library, which causes them to increase
  145.      the size of programs, not otherwise using standard I/O, more than might
  146.      be expected.  They also map an external cache file which can cause the
  147.      application to be larger than expected.
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.